package Temp.杂乱无章;

import java.util.Arrays;

public class 最小权值 {
    static final int a = 2050;
    static final long b = (long)1e18;
    static long[] c = new long[a];

    static long one(int now) {
        if(c[now] != b) return c[now];
        for(int i = 0; i <= now - 1; i++) {
            c[now] = Math.min(c[now], 1 + 2 * one(i) + 3 * one(now - i - 1) + (long)i * i * (now - i - 1));
        }
        return c[now];
    }

    public static void main(String[] args) {
        Arrays.fill(c, 1, 2022, b);
        long ans = one(2021);
        System.out.println(ans);
    }
}
